package com.kjlink.demo.sofa.consumer.controller;

import com.alipay.sofa.runtime.api.annotation.SofaReference;
import com.alipay.sofa.runtime.api.annotation.SofaReferenceBinding;
import com.alipay.sofa.runtime.api.annotation.SofaServiceBinding;
import com.kjlink.demo.sofa.common.model.FirstModel;
import com.kjlink.demo.sofa.common.service.FirstService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 描述:
 *
 * @author Vic.xu
 * @since 2025-10-23 17:28
 */
@Tag(name = "first", description = "测试sofa-rpc接口")
@RequestMapping("/first")
@RestController
public class FirstController {


    @SofaReference(binding = @SofaReferenceBinding(bindingType = "bolt"))
    private FirstService firstService;

    @Operation(summary = "获取列表")
    @GetMapping("/")
    public List<FirstModel> list() {
        return firstService.list();
    }

    @Operation(summary = "根据id获取")
    @GetMapping("/get")
    public FirstModel get(Integer id) {
        return firstService.get(id);
    }
}
